<#import '/ftlLibrary/properteisVariable.ftl' as pv/>
<div class="row">
    <label class="businessBtns col-lg-12 col-sm-12 col-xs-12 col-sm-offset-4 margin-top-20">
        <a type="btn" class="btn basicInfoBtnt" serializeNum="${serializeNum}" editUrl="${editUrl}" addSubtractType="1"
           onclick="showDialogAddSubtract(this);"
           style="background-color: #23a8f5;border: none;border-top-left-radius: 4px!important;border-bottom-left-radius: 4px!important;width: 120px;color: #fff;margin-right: 0!important;box-shadow:0px 0px 10px rgba(122,161,184,0.3);">
            加
        </a><a type="btn" class="btn basicInfoBtnt"  serializeNum="${serializeNum}" addSubtractType="2"
               onclick="showDialogAddSubtract(this);"
               style="border: none;border-top-right-radius: 4px!important;border-bottom-right-radius: 4px!important;width: 120px;color: #4a647d;box-shadow:0px 0px 10px rgba(122,161,184,0.3);">
        减
    </a>
    </label>
    <div class="col-lg-12 col-sm-12 col-xs-12">
        <form class="editForm" action="${saveUrl}" method="post" responseType="JSON" role="form"
              id="subtractTransitEditForm_${serializeNum}"
              data-bv-submitButtons="#editFormSubmitBtn_${serializeNum}"
              data-bv-message="This value is not valid"
              data-bv-feedbackicons-valid="glyphicon glyphicon-ok"
              data-bv-feedbackicons-invalid="glyphicon glyphicon-remove"
              data-bv-feedbackicons-validating="glyphicon glyphicon-refresh">
            <input type="hidden" name="id" value="${editEntity.id}">
            <#if (true && editModel=='add')||(true && editModel=='edit')>
                <div class="col-xm-12 col-sm-6 col-lg-12 margin-top-30">
                    <div class="form-group">
                        <label for="subtractClassHour" class="col-sm-2 col-sm-offset-1 control-label no-padding-right">减课时数（正课）：</label>
                        <div class="col-sm-2">
                            <input data-bv-integer-message="The field is number"
                                   data-bv-message="The field is not valid" data-bv-integer="true" size="11"
                                   name="subtractClassHour" alt="减课时数" id="subtractClassHour" placeholder="减课时数"
                                   type="text" title="减课时数" class="form-control"
                                   value="${editEntity.subtractClassHour}"/>
                            <span class="text"></span>
                        </div>
                        <label class="control-label">课时 <span style="margin-left: 30px">扣权责：—</span></label>
                    </div>
                </div>
            </#if>
            <#if (true && editModel=='add')||(true && editModel=='edit')>
                <div class="col-xm-12 col-sm-6 col-lg-12">
                    <div class="form-group">
                        <label for="subtractClassHour" class="col-sm-2 col-sm-offset-1 control-label no-padding-right">减课时数（赠课）：</label>
                        <div class="col-sm-2">
                            <input size="11" alt="减课时数" placeholder="减课时数"
                                   type="text" title="减课时数" class="form-control"/>
                            <span class="text"></span>
                        </div>
                        <div class="col-sm-1 control-label" style="width: 26px;padding: 0">
                            课时
                        </div>
                        <label for="subtractClassHour" class="col-sm-2 control-label no-padding-right" style="margin-left: 22px">减课时数（赠课）：</label>
                        <div class="col-sm-3">
                            <input size="11" alt="减课时数" placeholder="减课时数"
                                   type="text" title="减课时数" class="form-control"/>
                            <span class="text"></span>
                        </div>
                        <label class="control-label">课时</label>
                    </div>
                </div>
            </#if>
            <#if (true && editModel=='add')||(true && editModel=='edit')>
                <div class="col-xm-12 col-sm-6 col-lg-12">
                    <div class="form-group">
                        <label for="remark" class="col-sm-2 col-sm-offset-1 control-label no-padding-right">备注</label>
                        <div class="col-sm-6">
                           <textarea class="form-control" name="remark" maxlength="499" rows="2" style="resize:none"
                                     id="remark" data-bv-field="remark" value="${editEntity.remark}"></textarea>
                        </div>
                    </div>
                </div>
            </#if>
            <div class="col-sm-12 text-align-center margin-top-20 ">
                <button style="width: 80px;margin-right: 20px" type="submit" class="btn btn-blue" id="editFormSubmitBtn_${serializeNum}">确定</button>
                <input style="width: 80px;" type="button" class="btn btn-default" data-dismiss="modal" value="取消" />

            </div>
        </form>
        <span>剩余正课 ${data.surplusFormalAttendanceDay}</span>
        <span>剩余赠课 ${data.surplusPresentAttendanceDay}</span>
    </div>
</div>
<script src="assets/js/validation/bootstrapValidator_init.js"></script>
<script>
    $(".selectpicker_${serializeNum}").select2();
    $("#subtractTransitEditForm_${serializeNum}").bind("ajaxSubmitCallback", function (event, result) {
        if (result.resCode == 200) {
            bootbox.hideAll();
            logger.info("保存成功", true);
        } else {
            logger.error("保存失败");
        }
    });
    function showDialogAddSubtract(that) {
        var serializeNum = $(that).attr("serializeNum");
        var addSubtractType=$(that).attr("addSubtractType");
        ajaxRequest("tssMemberAddSubtractRecordController/toEditView.do", {
            serializeNum: serializeNum,
            addSubtractType:addSubtractType,
            type:1
        }, function (html) {
            getTopWin().bootbox.dialog({
                message: html,
                title: "亲子加减课时",
                className: 'myDialog'
            });
        }, function () {
            ajaxError("加载页面失败!")
        }, "get", "html")
    }

</script>